package com.example.controller;

import com.example.DTO.ProductDTO;
import com.example.entity.Product;
import com.example.result.Result;
import com.example.service.DeepSeekService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/Ai")
public class DeepSeekController {
    @Autowired
    private DeepSeekService deepSeekService;
    //localhost:8080/Ai/translate/5
    //eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOjEsImlhdCI6MTc0OTA4NzEwNSwiZXhwIjoxNzQ5MTIzMTA1fQ.sNBE-7ESN-OEbnovEQmDLue8jTzblN0778Mq_6M40iM
    @GetMapping("/translate/{productId}")
    public Result<Product> tranSlate(@PathVariable int productId) throws IOException {
        return Result.success(deepSeekService.tranSlate(productId));
    }

    @GetMapping("/abbreviation")
    public Result<List<ProductDTO>> abbreviation(@RequestParam String text) throws IOException {
        return Result.success(deepSeekService.abbreviation(text));
    }
}
